Conversation
The time axis now goes to either the value of `DATa:STOP` or the record length, depending on which of the two is lower.
|
I don't have a scope to test, but are you sure that this will work. In the default case, the number of sample is |
|
Thank you for reviewing my suggestion @clade. According to my experience with DPO2024B and DPO4104 oscilloscopes, the returned waveform is shorter than the record length when import matplotlib.pyplot as plt
from PyTektronixScope import TektronixScope
scope = TektronixScope()
fig, ax = plt.subplots()
ax.set(xlabel='time / s', ylabel='voltage / V')
for start in (1, 10):
print(f'Data start {start}\n##########')
scope.set_data_start(start)
for rl in (100000, 1000000):
print(f'Record length {rl}\n#####')
scope.set_horizontal_record_length(rl)
time, voltage = scope.read_data_one_channel('CH1', x_axis_out=True)
print(f'Received {time.size} data points for the time axis and '
f'{voltage.size} data points for the voltage signal.')
ax.plot(time, voltage, label=f'Data start {start}, record length {rl}')
ax.legend()
fig.tight_layout()When using my suggestion X_axis = (self.x_0 +
np.arange(self.data_start-1,
min((self.data_stop,
self.get_horizontal_record_length()))) *
self.delta_x)for constructing the x axis, this test normally* worked without any problems, with the command line output being The DPO/MSO2000/B series distinguishes between a nominal and an actual record length. According to the manual, receiving 125000 datapoints at a nominal record length of 100000 is a normal behavior. Due to the equal length of time and value axis, the data was also plotted without any problem Your version for constructing the time axis start = self.data_start - 1
stop = np.min((self.data_stop, start + self.get_horizontal_record_length()))
X_axis = self.x_0 + np.arange(start, stop)*self.delta_x(slightly modified so that until it throws a As a conclusion, I would still prefer my version, although I have to admit that the test I just described is the only one I did. *My test normally worked using the construction of the time axis I suggested, but I tried it several times and in rare cases, there were different anomalies in the data that appeared to me like synchronizations problems, i.e. as if we would need to query |
|
I have now finally found the opportunity to take another look at the synchronization problems I encountered in the test described above. They were simply due to the fact that I did not wait for a moment after calling It takes a moment for It is somewhat surprising that X_axis = (self.x_0 +
np.arange(self.data_start-1,
min((self.data_stop,
self.get_horizontal_record_length()))) *
self.delta_x)but with start = self.data_start - 1
stop = np.min((self.data_stop, start + self.get_horizontal_record_length()))
X_axis = self.x_0 + np.arange(start, stop)*self.delta_xit is not for |

The time axis now goes to either the value of
DATa:STOPor the record length, depending on which of the two is lower.Fixes #21